package org.example.springboot.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.springboot.entity.Order;

import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {
    
    /**
     * 根据商户ID查询订单ID列表
     * 注意：这里假设商品表(product)有merchantId字段，通过关联查询获取商户的订单
     * 
     * @param merchantId 商户ID
     * @return 订单ID列表
     */
    @Select("SELECT o.id FROM `order` o " +
            "INNER JOIN product p ON o.product_id = p.id " +
            "WHERE p.merchant_id = #{merchantId}")
    List<Long> selectOrderIdsByMerchantId(Long merchantId);
} 